package com.dbg.entity;

import com.dbg.code.ResultCode;

import java.util.HashMap;
import java.util.Objects;


public class ResultEntity {

    private int CODE;
    private HashMap<String, Object> resultMap = new HashMap<>();

    public ResultEntity() {

    }

    public ResultEntity(int CODE) {
        this.CODE = CODE;
    }

    public ResultEntity(int CODE, HashMap<String, Object> resultMap) {
        this.CODE = CODE;
        this.resultMap = resultMap;
    }

    public ResultEntity setMessage(String key, Object value) {
        this.resultMap.put(key, value);
        return this;
    }

    public Object getMessage(String key) {
        return this.resultMap.get(key);
    }

    public boolean isERROR() {
        return this.CODE == ResultCode.ERROR;
    }

    public boolean isSUCCESS() {
        return this.CODE == ResultCode.SUCCESS;
    }

    public boolean isNOT_FOUND() {
        return this.CODE == ResultCode.NOT_FOUND;
    }

    public int getCODE() {
        return CODE;
    }

    public void setCODE(int CODE) {
        this.CODE = CODE;
    }

    public HashMap<String, Object> getResultMap() {
        return resultMap;
    }

    public void setResultMap(HashMap<String, Object> resultMap) {
        this.resultMap = resultMap;
    }
}
